<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>title</title>
	<link rel="stylesheet" type="text/css" href="../css/api.css" />
	<!-- <link rel="stylesheet" type="text/css" href="../css/menu.css" /> -->
	<link rel="stylesheet" type="text/css" href="../css/mzui/css/mzui.min.css" />
	<style>
		th {
			text-align: center;
		}

		td {
			text-align: center;
		}

		.infoTop {
			background-color: #d65b5d;
			height: 73px;
			/* border-bottom:1px solid #994c00; */
			text-align: center;
			/* border:1px solid red; */
		}

		.infoTop a {
			position: absolute;
			height: 37px;
			padding: 34px 20px 0 20px;
			top: 0px;
			left: 0px;
			cursor: pointer;
		}

		.infoTop img {
			height: 25px;
		}

		.infoTop span {
			position: absolute;
			top: 24px;
			left: 150px;
			font-size: 20px;
			height: 50px;
			line-height: 50px;
			color: #fff;
			cursor: default;
		}

		.infoTop .nav {
			float: left;
			width: 25px;
			height: 25px;
			margin: 35px 15px auto 20px;
		}

		.infoTop .moretype {
			position: absolute;
			top: 29px;
			right: 15px;
			height: 40px;
			width: 40px;
			line-height: 40px;
			color: #fff;
			cursor: pointer;
			background: url() no-repeat right 10px;
			/*background:url() no-repeat right 10px;*/
			background-size: 20px 20px;
		}
	</style>
</head>

<body>

	<div class="page">

		<div class="infoTop">
			<img class="nav" id="openMenu" src=""
			/>
			<!-- <a onClick="javascript :api.closeWin();"><img alt="返回" src="" title="back"></a> -->
			<span>试块入库</span>
			<div class="moretype" onclick="showscanner()"> </div>
		</div>

		<div class="container" style="margin-top:1rem">
			<div class="content box" style="margin-top:1rem">
				<div class="row">
					<div class="cell-12">

						<div class="control">
							<label for="meltingStove">炉次</label>
							<input type="text" class="input" id="meltingStove" name="meltingStove" value="" />
							<label for="meltingWrap">包次</label>
							<input type="text" class="input" id="meltingWrap" name="meltingWrap" value="" />
							<label for="texture">材质</label>
							<input type="text" class="input" id="texture" name="texture" value="" />
							<button id="saveBtn" type="button" class="btn  btn-lg block" style="margin-top:6px;background-color: #d65b5d;color:white; ">查询</button>
						</div>

					</div>

				</div>
			</div>
		</div>

	</div>

</body>
<script type="text/javascript" src="../script/public/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/core/core.js"></script>
<!--<script type="text/javascript" src="../script/mzui/js/mzui.min.js"></script>-->
<script type="text/javascript">
	apiready = function() {

		exitApp();


		var meltingStove = $.trim($("#meltingStove").val()); //铸件号
		var meltingWrap = $.trim($("#meltingWrap").val()); //产品名称
		var texture = $.trim($("#texture").val()); //产品名称

		api.openFrame({
			name: 'frm_inStorage',
			url: 'frm_inStorage.html',
			reload: true,
			pageParam: {
				meltingStove: meltingStove,
				meltingWrap: meltingWrap,
				texture: texture
			},
			rect: {
				x: 0,
				y: 330,
				w: 'auto',
				h: 'auto'
			}
		});
		//右滑打开菜单
		api.addEventListener({
			name: 'swiperight'
		}, function(ret, err) {
			api.openFrame({
				name: 'leftMenu',
				url: 'left_menu.html',
				rect: {
					x: 0,
					y: 0,
					w: api.winWidth / 2,
					h: api.winHeight
				}
			});
		});

		//测试--不能触屏

		$("#openMenu").click(function() {
			api.openFrame({
				name: 'leftMenu',
				url: 'left_menu.html',
				rect: {
					x: 0,
					y: 0,
					w: api.winWidth / 2,
					h: api.winHeight
				}
			});
		});



		//	    setListenerAjpush();
		//	    setNotice();
	};


	//点击查询按钮
	$("#saveBtn").click(function() {
		var meltingStove = $.trim($("#meltingStove").val()); //铸件号
		var meltingWrap = $.trim($("#meltingWrap").val()); //产品名称
		var texture = $.trim($("#texture").val()); //产品名称

		api.openFrame({
			name: 'frm_inStorage',
			url: 'frm_inStorage.html',
			reload: true,
			pageParam: {
				meltingStove: meltingStove,
				meltingWrap: meltingWrap,
				texture: texture
			},
			rect: {
				x: 0,
				y: 330,
				w: 'auto',
				h: 'auto'
			}
		});



	});

	function exitApp() {
		api.addEventListener({
			name: 'keyback'
		}, function(ret, err) {
			api.toast({
				msg: '再按一次返回键退出' + api.appName,
				duration: 2000,
				location: 'bottom'
			});

			api.addEventListener({
				name: 'keyback'
			}, function(ret, err) {
				api.closeWidget({
					id: 'A6057658489882', //这里改成自己的应用ID
					retData: {
						name: 'closeWidget'
					},
					silent: true
				});
			});

			setTimeout(function() {
				exitApp();
			}, 3000)
		});
	}

	function showscanner() {
		api.openWin({
			name: 'win_inStorageForAdd',
			url: 'win_inStorageForAdd.html',
			reload: true,
			pageParam: {

			},
			rect: {
				x: 0,
				y: 0,
				w: 'auto',
				h: 'auto'
			}
		});


	}

	function setTagsName() {

		var role = $api.getStorage("user").role;
		//var shopId = kitChen.shopsAccountEntity.objId;
		//var unit=api.pageParam.unit;
		//alert("智能体：--分组"+role)
		var ajpush = api.require('ajpush');
		var param = {
			tags: [role]
		};
		ajpush.bindAliasAndTags(param, function(ret) {
			var statusCode = ret.statusCode;
			//alert(JSON.stringify(ret));
		});
	}

	function setListenerAjpush() {
		//alert("监听");
		var ajpush = api.require('ajpush');
		ajpush.setListener(function(ret) {
			//alert("不坑爹");
			api.startPlay({
				path: 'widget://res/1.mp3'
			}, function() {
				api.startRecord();
			});
			var content = ret.content;
			//alert("监听内容"+content);
			var id = content.substring(0, content.indexOf('_'));
			//				//alert("监听内容id"+id);
			var type = content.substring(content.indexOf('_') + 1, content.length); //仓库
			//				//alert("监听内容type"+type);
			if (type == '0') { //配送计划
				api.openFrame({
					name: 'frm_getPushInfo',
					url: 'frm_getPushInfo.html',
					reload: true,
					pageParam: {
						id: id,
						type: type

					},
					rect: {
						x: 0,
						y: 0,
						w: 'auto',
						h: 'auto'
					}
				});
			} else { //领料单
				api.openFrame({
					name: 'frm_getPushInfoPicking',
					url: 'frm_getPushInfoPicking.html',
					reload: true,
					pageParam: {
						id: id,
						type: type

					},
					rect: {
						x: 0,
						y: 0,
						w: 'auto',
						h: 'auto'
					}
				});
			}
		});
	}

	function setNotice() {
		//alert("等通知");
		api.addEventListener({
			name: 'appintent'
		}, function(ret, err) {
			if (ret && ret.appParam.ajpush) {
				var ajpush = ret.appParam.ajpush;
				var content = ajpush.content;
				// alert("点通知内容"+content);
				var id = content.substring(0, content.indexOf('_'));
				//			        //alert("点通知内容id"+id);
				var type = content.substring(content.indexOf('_') + 1, content.length); //仓库
				//					//alert("点通知内容type"+type);
				if (type == '0') { //配送计划
					api.openFrame({
						name: 'frm_getPushInfo',
						url: 'frm_getPushInfo.html',
						reload: true,
						pageParam: {
							id: id,
							type: type

						},
						rect: {
							x: 0,
							y: 0,
							w: 'auto',
							h: 'auto'
						}
					});
				} else { //领料单
					api.openFrame({
						name: 'frm_getPushInfoPicking',
						url: 'frm_getPushInfoPicking.html',
						reload: true,
						pageParam: {
							id: id,
							type: type

						},
						rect: {
							x: 0,
							y: 0,
							w: 'auto',
							h: 'auto'
						}
					});
				}

			}
		});
	}
</script>

</html>
